using UnityEngine;

namespace Crosstales.OnlineCheck.Demo
{
    // [Assembly-CSharp-firstpass.dll].Crosstales.OnlineCheck.Demo.GUIMain
    public class GUIMain : MonoBehaviour
    {
        // Fields
        public UnityEngine.UI.Text Name;
        public UnityEngine.UI.Text Version;
        public UnityEngine.UI.Text Scene;
        public UnityEngine.UI.Image Status;
        public UnityEngine.UI.Slider MinimumSlider;
        public UnityEngine.UI.Slider MaximumSlider;
        public UnityEngine.UI.Text MinValue;
        public UnityEngine.UI.Text MaxValue;
        public UnityEngine.UI.Text Available;
        public UnityEngine.UI.Text Reachability;
        public UnityEngine.UI.Text LastCheck;
        public UnityEngine.UI.Text Total;
        public UnityEngine.UI.Text PerMinute;
        public UnityEngine.UI.Text Data;
        public UnityEngine.UI.Text Runtime;
        public UnityEngine.UI.Text Uptime;
        public UnityEngine.UI.Text Downtime;
        private readonly UnityEngine.Color32 green;
        private readonly UnityEngine.Color32 red;
        private float elapsedTime;
        private bool hasSliders;
        
        // Methods
        private void Start()
        {
            var val_26;
            UnityEngine.UI.Slider val_27;
            bool val_28;
            val_26 = 27399672;
            Crosstales.OnlineCheck.OnlineCheck.Crosstales.OnlineCheck.OnlineCheck.OnlineCheckComplete val_2 = 536899519;
            val_2 = new Crosstales.OnlineCheck.OnlineCheck.Crosstales.OnlineCheck.OnlineCheck.OnlineCheckComplete(object:  this, method:  1610683223);
            Crosstales.Common.Util.Singleton<System.Object>.Instance.add_OnOnlineCheckComplete(value:  val_2);
            bool val_3 = UnityEngine.Object.op_Inequality(x:  this.Name, y:  0);
            bool val_4 = UnityEngine.Object.op_Inequality(x:  this.Version, y:  0);
            if(this.Scene != 0)
            {
                    UnityEngine.SceneManagement.Scene val_6 = UnityEngine.SceneManagement.SceneManager.GetActiveScene();
                string val_7 = val_6.m_Handle.name;
            }
            
            val_27 = this.MinimumSlider;
            if(val_27 != 0)
            {
                    val_27 = this.MaximumSlider;
                val_28 = UnityEngine.Object.op_Inequality(x:  val_27, y:  0);
            }
            else
            {
                    val_28 = false;
            }
            
            this.hasSliders = val_28;
            Unknown val_10 = Crosstales.Common.Util.Singleton<System.Object>.Instance;
            if((val_10 + 25) == 0)
            {
                    return;
            }
            
            if(this.hasSliders == false)
            {
                    return;
            }
            
            val_27 = this.MinValue;
            if(val_27 == 0)
            {
                    return;
            }
            
            val_27 = this.MaxValue;
            if(val_27 == 0)
            {
                    return;
            }
            
            int val_14 = Crosstales.Common.Util.Singleton<System.Object>.Instance.IntervalMin;
            int val_16 = Crosstales.Common.Util.Singleton<System.Object>.Instance.IntervalMax;
            string val_19 = Crosstales.Common.Util.Singleton<System.Object>.Instance.IntervalMin.ToString();
            string val_22 = Crosstales.Common.Util.Singleton<System.Object>.Instance.IntervalMax.ToString();
            val_26 = 27339584;
            UnityEngine.Events.UnityAction<System.Single> val_23 = 536879183;
            val_23 = new UnityEngine.Events.UnityAction<System.Single>(object:  this, method:  1610683227);
            this.MinimumSlider.m_OnValueChanged.AddListener(call:  val_23);
            UnityEngine.Events.UnityAction<System.Single> val_24 = 536879183;
            val_27 = this.MaximumSlider.m_OnValueChanged;
            val_24 = new UnityEngine.Events.UnityAction<System.Single>(object:  this, method:  1610683229);
            val_27.AddListener(call:  val_24);
        }
        private void Update()
        {
            UnityEngine.UI.Slider val_27;
            if((this.hasSliders != false) && (V0.16B >= S0))
            {
                    val_27 = this.MinimumSlider;
                float val_1 = S0 + (-1f);
            }
            
            float val_2 = UnityEngine.Time.deltaTime;
            val_2 = this.elapsedTime + val_2;
            this.elapsedTime = val_2;
            if(val_2 <= 1f)
            {
                    return;
            }
            
            if(this.Available != 0)
            {
                    Unknown val_4 = Crosstales.Common.Util.Singleton<System.Object>.Instance;
                var val_5 = ((val_4 + 121) == 0) ? 27508616 : 27524400;
            }
            
            if(this.Reachability != 0)
            {
                    string val_8 = Crosstales.Common.Util.Singleton<System.Object>.Instance.NetworkReachabilityShort;
            }
            
            if(this.LastCheck != 0)
            {
                    Unknown val_10 = Crosstales.Common.Util.Singleton<System.Object>.Instance;
                string val_11 = val_10 + 128.ToString();
            }
            
            if(this.Total != 0)
            {
                    string val_13 = mem[536884463].ToString();
            }
            
            if(this.PerMinute != 0)
            {
                    string val_16 = Crosstales.OnlineCheck.Util.Context.ChecksPerMinute.ToString(format:  -1610612241);
            }
            
            if(this.Data != 0)
            {
                    Unknown val_18 = Crosstales.Common.Util.Singleton<System.Object>.Instance;
                string val_19 = Crosstales.Common.Util.BaseHelper.FormatBytesToHRF(bytes:  val_18 + 136, useSI:  false);
            }
            
            if(this.Runtime != 0)
            {
                    string val_21 = Crosstales.Common.Util.BaseHelper.FormatSecondsToHRF(seconds:  (double)mem[536884463] + 4);
            }
            
            if(this.Uptime != 0)
            {
                    string val_23 = Crosstales.Common.Util.BaseHelper.FormatSecondsToHRF(seconds:  (double)mem[536884463] + 8);
            }
            
            val_27 = this.Downtime;
            if(val_27 != 0)
            {
                    val_27 = this.Downtime;
                string val_26 = Crosstales.Common.Util.BaseHelper.FormatSecondsToHRF(seconds:  (double)(mem[536884463] + 4) - (mem[536884463] + 4 + 4));
            }
            
            this.elapsedTime = 0f;
        }
        private void OnDestroy()
        {
            if((Crosstales.Common.Util.Singleton<System.Object>.Instance) == 0)
            {
                    return;
            }
            
            Crosstales.OnlineCheck.OnlineCheck.Crosstales.OnlineCheck.OnlineCheck.OnlineCheckComplete val_4 = 536899519;
            val_4 = new Crosstales.OnlineCheck.OnlineCheck.Crosstales.OnlineCheck.OnlineCheck.OnlineCheckComplete(object:  this, method:  1610683223);
            Crosstales.Common.Util.Singleton<System.Object>.Instance.remove_OnOnlineCheckComplete(value:  val_4);
        }
        public void Check()
        {
            Crosstales.Common.Util.Singleton<System.Object>.Instance.Refresh(triggerCallbacks:  false);
        }
        public void ChangeIntervalMin()
        {
            Crosstales.Common.Util.Singleton<System.Object>.Instance.IntervalMax = (S0 == Infinityf) ? -2147483648 : ((int)S0);
            string val_5 = Crosstales.Common.Util.Singleton<System.Object>.Instance.IntervalMax.ToString();
            Crosstales.Common.Util.Singleton<System.Object>.Instance.IntervalMin = (S0 == Infinityf) ? -2147483648 : ((int)S0);
            string val_10 = Crosstales.Common.Util.Singleton<System.Object>.Instance.IntervalMin.ToString();
        }
        public void ChangeIntervalMax()
        {
            Crosstales.Common.Util.Singleton<System.Object>.Instance.IntervalMin = (S0 == Infinityf) ? -2147483648 : ((int)S0);
            string val_5 = Crosstales.Common.Util.Singleton<System.Object>.Instance.IntervalMin.ToString();
            Crosstales.Common.Util.Singleton<System.Object>.Instance.IntervalMax = (S0 == Infinityf) ? -2147483648 : ((int)S0);
            string val_10 = Crosstales.Common.Util.Singleton<System.Object>.Instance.IntervalMax.ToString();
        }
        private void colorKnob(bool available, UnityEngine.NetworkReachability networkReachability)
        {
            if(this.Status == 0)
            {
                    return;
            }
            
            var val_2 = (available != true) ? 160 : 164;
            float val_6 = 255f;
            float val_3 = 0f;
            float val_4 = 80f;
            float val_5 = 97f;
            val_3 = val_3 / val_6;
            val_4 = val_4 / val_6;
            val_5 = val_5 / val_6;
            val_6 = 16f / val_6;
            this.Status.color = new UnityEngine.Color() {r = val_3, g = val_4, b = val_5, a = val_6};
        }
        public GUIMain()
        {
            this.green = -1.55226522796504E+155;
        }
        private void <Start>b__21_0(float _p0_)
        {
            this.ChangeIntervalMin();
        }
        private void <Start>b__21_1(float _p0_)
        {
            this.ChangeIntervalMax();
        }
    
    }

}
